<%--
  Created by IntelliJ IDEA.
  User: Cesiumai
  Date: 2016/6/14
  Time: 14:15
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ include file="/manage/system/pageBase.jsp" %>
<%@ page info="轮播图设置" %>
<%@page import="java.net.InetAddress"%>

<input type="hidden" value="<%=InetAddress.getLocalHost().getHostAddress()%>" id="serverIp"/>
<input type="hidden" value="<%=request.getServerPort()%>" id="serverPort"/>
<form action="<%=path%>/manage/carousel" method="post">
    <div style="height:auto!important;height:550px;min-height:550px;">
        <h3 style="border-bottom: 1px solid #D7D7D7;color: #666666;font-size: 28px;padding-bottom: 20px;margin-bottom: 30px;">
            <%=getServletInfo()%>
            <a href="toAdd" class="btn btn-primary"
               style="padding: 2px 15px;float:right;">
                <i class="icon-plus "></i>新增
            </a>
        </h3>
        
       
     
        <table class="table table-bordered table-hover table-striped">
            <tr>
                <th>id</th>
                <th>图片</th>
                <th>所属页面</th>
                <th>图片名称</th>
                <th>状态</th>
                <th>链接</th>
                <th width="200">操作</th>
            </tr>
            
            <c:forEach var="item" items="${pager.list}">
                <tr>          
                    <td>${item.id}</td>
                    <td><a href="<%=SystemManage.getInstance().getSystemSetting().getImageRootPath()%>${item.image}" target="_blank"><img  src="<%=SystemManage.getInstance().getSystemSetting().getImageRootPath()%>${item.image}" width="20px" height="20px"></a></td>
                    <td>${item.pageName}</td>
                    <td>${item.imageName}</td>
                    <td>
                    	<c:if test="${item.status eq '1'}">显示</c:if>
                    	<c:if test="${item.status eq '0'}">隐藏</c:if>
                    </td>
                    <td name="fullUrl">${item.image}</td>
                    <td><a href="toEdit?id=${item.id}">编辑</a> | <a href="toDel?id=${item.id}">删除</a></td>
                </tr>
            </c:forEach>
            <tr>
                <td colspan="71" style="text-align: center;">
                    <%@ include file="/manage/system/page.jsp" %>
                </td>
            </tr>
        </table>
    </div>
</form>
<script type="text/javascript">
	$.each($("td[name='fullUrl']"),function(i,val){
		var a = val.innerHTML;
		val.innerHTML=fullUrl(a);
		
	});



	function fullUrl(url){
		return "http://" + $("#serverIp").val() + ":" + $("#serverPort").val() + url;
	}

    //查询
    function selectList(obj) {

        var _form = $("form");
        _form.attr("action", $(obj).attr("method"));
        _form.submit();
    }
</script>

<%@ include file="/manage/system/baseFoot.jsp" %>
